<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a="http://richfaces.org/a4j"
    template="/layout/template.xhtml">

<ui:define name="body">

    <rich:panel id="painelFiltro">
        <f:facet name="header">Filtro de Cargos</f:facet>
		    	<h:form>
		            <s:decorate id="concursoField" template="/layout/edit.xhtml">
		                <ui:define name="label">Concurso</ui:define>
		                <h:selectOneMenu value="#{cargoList.concurso}" >
			                 <s:selectItems value="#{concursoList.resultList}" var="_iten" itemValue="#{_iten}"  label="#{_iten.nome}"  noSelectionLabel="Selecione um Concurso" hideNoSelectionLabel="false"/>
			                 <s:convertEntity/>
			                 <a:support event="onchange" action="#{cargoList.buscar()}" reRender="painelResultado"/>
		                </h:selectOneMenu>
		            </s:decorate>
		            
		            <rich:spacer height="2" />
		            
			          <div style="clear:both"/>
            
		    	</h:form>
    </rich:panel>


    <rich:panel id="painelResultado">
        <f:facet name="header">Listagem de Cargos</f:facet>

        <div class="results">

            <h:outputText value="Selecione um Concurso"
                       rendered="#{empty listaDeCargos}"/>

            <rich:dataTable id="cargoList" var="cargo"
                      value="#{listaDeCargos}"
                   rendered="#{not empty listaDeCargos}">
                <h:column>
                    <f:facet name="header">Codigo</f:facet>
                    #{cargo.codigo}
                </h:column>
                <h:column>
                    <f:facet name="header">Descrisao</f:facet>
                    <s:link id="cargo"
                         value="#{cargo.nome}"
                   propagation="none"
                         view="/modulo/cargo.xhtml">
                        <f:param name="cargoId"
                                value="#{cargo.id}"/>
                    </s:link>
                </h:column>
                <h:column>
                    <f:facet name="header">Valor</f:facet>
                    #{cargo.valorTaxaInscicao}
                </h:column>
                <h:column>
                    <f:facet name="header">Concurso</f:facet>
                    #{cargo.concurso.nome}
                </h:column>
            </rich:dataTable>

        </div>

    </rich:panel>

    <div class="actionButtons">
        <s:button id="done"
               value="Cadastrar novo"
                view="/modulo/cargo.xhtml"/>
    </div>

</ui:define>

</ui:composition>
